package com.example.gmallconsumerdubbospringboot.serviceImpl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.example.gmallinterfacedubbospringboot.rr.pojo.UserAddress;
import com.example.gmallinterfacedubbospringboot.rr.service.OrderService;
import com.example.gmallinterfacedubbospringboot.rr.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author : RENBIAO
 * @createTime : 2021/7/8 19:10
 */
@Component
@Service  //暴露服务
public class OrderServiceImpl implements OrderService {

    @Reference
//    @Reference(loadbalance = "")   //配置负载均衡策略
    UserService userService;

    /**
     * 根据用户ID，查找用户收货地址信息
     **/
    @Override
    public List<UserAddress> initOrder(String userId) {

        //查询用户收货地址：远程调用
        List<UserAddress> userAddressList = userService.getUserAddressList(userId);
        return userAddressList;
    }
}